package com.crayfish.quduo.ui.activity;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.support.v4.app.NotificationCompat;
import android.widget.RelativeLayout;

import com.crayfish.quduo.R;
import com.crayfish.quduo.base.BaseMvpActivity;
import com.crayfish.quduo.model.WelcomeBean;
import com.crayfish.quduo.presenter.WelcomePresenter;
import com.crayfish.quduo.presenter.contract.WelcomeContract;
import com.crayfish.quduo.utils.DomobUtil;
import com.crayfish.quduo.utils.ToastUtil;


import java.util.Timer;
import java.util.TimerTask;

import butterknife.BindView;
//import cn.domob.android.ads.RTSplashAd;
//import cn.domob.android.ads.SplashAd;
//import cn.domob.android.ads.SplashAdListener;

/**
 * Created by crayfish on 2016/12/8.
 */
public class WelcomeActivity extends BaseMvpActivity<WelcomePresenter> implements WelcomeContract.View{

//    @BindView(R.id.banner)
//    RelativeLayout banner;

    @Override
    protected WelcomePresenter createPresenter() {
        return new WelcomePresenter();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_welcome;
    }

    @Override
    protected void initEventAndData() {
        mPresenter.getWelcomeData();
//        DomobUtil.ShowSplash(WelcomeActivity.this, banner, new DomobUtil.SplashCallBack() {
//            @Override
//            public void SplashAfter() {
//                startMainActivity();
//            }
//        });
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
              startMainActivity();
            }
        },2000);
    }

    private void startMainActivity() {
        WelcomeActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }

    @Override
    public void showContent(WelcomeBean welcomeBean) {

    }

    @Override
    public void showError(String msg) {
        ToastUtil.show(msg);
    }
}
